package vip.xiaozhao.paotui.intf.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import vip.xiaozhao.paotui.intf.entity.PayChannelAudit;

@Mapper
public interface PayChannelMapper {

    @Select("select * from yike_pay_channel_audit where id=#{id}")
    PayChannelAudit loadById(int id);

    @Insert(" insert into yike_pay_channel_audit(\n" +
            "\t\tid,UserId,OrderId,EngineId,PayChannel,PayMethod,PayAmount,Status,TradeNo,OutTradeNo,Source,Msg,AddTime,UpdateTime,UserIp,PartnerId\n" +
            "\t\t)values(\n" +
            "\t\tnull,#{userId},#{orderId},#{engineId},#{payChannel},\n" +
            "\t\t#{payMethod},#{payAmount},#{status},#{tradeNo},\n" +
            "\t\t#{outTradeNo},#{source},#{msg},now(),now(),#{userIp:VARCHAR},\n" +
            "\t\t#{partnerId})")
    @Options(useGeneratedKeys = true, keyColumn = "id", keyProperty = "id")
    int insert(PayChannelAudit channelPay);

    @Select("select * from yike_pay_channel_audit where TradeNo=#{tradeNo} and Source =#{source} ")
    PayChannelAudit loadByTradeNoAndSoure(String tradeNo, int source);


}
